<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:70:"D:\phpStudy\WWW\oa\public/../application/admin\view\role\rolesave.html";i:1514956991;}*/ ?>
<!--<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<style>
    .bodys {
        color: #666;
    }

    .div {
        text-align: center;
        width: 1080px;
        margin: auto;
        padding-bottom: 30px;
    }

    table {
        border-collapse: collapse;
        width: 1080px
    }

    .spans {
        color: #000000;
        font-family: 黑体
    }

    .test_a {
        border: 1px solid black;
        width: 20%;
        vertical-align: middle;
        text-align: center;
        padding: 1px;
    }

    .test_b {
        border: 1px solid black;
        width: 70%;
        vertical-align: middle;
        text-align: left;
        padding: 20px
    }
</style>
<body class="bodys panel admin-panel">
<div class="panel-head"><strong><span class="icon-pencil-square-o"></span>角色信息</strong>&emsp;<a
        style="color: #3a4bfb;font-weight: bold " href="javascript:history.go(-1)">返回上一步</a></div>
<div class="div">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div style="margin-top: 10px" class="layui-input-block">
                <input name="role" id="role" type="text" class="layui-input" lay-verify="required" value="<?php echo $role['role']; ?>">
            </div>
        </div>
        <input type="hidden" name="id" value="<?php echo $role['id']; ?>">
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" name="descript"><?php echo $role['descript']; ?></textarea>
            </div>
        </div>
        <div id="div_a">
            <table id="table" lay-filter="">
                <?php if(is_array($jurisdiction) || $jurisdiction instanceof \think\Collection || $jurisdiction instanceof \think\Paginator): $i = 0; $__LIST__ = $jurisdiction;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <tr>
                    <td class="test_a">
                        <div class="layui-form-item">
                            <div id="iii" style="text-align: center" class="layui-input-block">
                                <?php if($vo['state'] == 1): ?>
                                <input onclick='selectAlls("<?php echo $vo['id']; ?>")' checked="checked" class="<?php echo $vo['id']; ?>"
                                       name="like<?php echo $vo['id']; ?>" id="<?php echo $vo['id']; ?>"
                                       type="checkbox" title="<?php echo $vo['jurisdiction']; ?>" value="<?php echo $vo['id']; ?>"/>
                                <?php else: ?>
                                <input onclick='selectAlls()' class="<?php echo $vo['id']; ?>" name="like<?php echo $vo['id']; ?>"
                                       id="<?php echo $vo['id']; ?>" type="checkbox"
                                       value="<?php echo $vo['id']; ?>" title="<?php echo $vo['jurisdiction']; ?>"/>
                                <?php endif; ?>
                            </div>
                        </div>

                    </td>
                    <td class="test_b">
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <?php if(is_array($vo['child']) || $vo['child'] instanceof \think\Collection || $vo['child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vv): $mod = ($i % 2 );++$i;if($vv['state'] == 1): ?>
                                <input lay-skin="primary" onclick='cws("<?php echo $vo['id']; ?>")' checked="checked" value="<?php echo $vv['id']; ?>"
                                       type="checkbox" name="like<?php echo $vv['id']; ?>" class="<?php echo $vo['id']; ?>"
                                       title="<?php echo $vv['jurisdiction']; ?>"/>&nbsp;&emsp;
                                <?php else: ?>
                                <input lay-skin="primary" onclick='cws("<?php echo $vo['id']; ?>")' type="checkbox" value="<?php echo $vv['id']; ?>"
                                       class="<?php echo $vo['id']; ?>" name="like<?php echo $vv['id']; ?>" title="<?php echo $vv['jurisdiction']; ?>"/>&nbsp;&emsp;
                                <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                            </div>
                        </div>

                    </td>
                </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </table>
        </div>

        <div class="layui-form-item">
            <div style="margin: auto" class="layui-input-block">
                &lt;!&ndash;<input type="checkbox" name="like[all]" title="全选" id="qx" value="全选"/>&ndash;&gt;
                &lt;!&ndash;<input style="text-align: center; margin-top: 20px"  type="submit" class="layui-btn" name="submit" value="确定修改"/>&ndash;&gt;
                <button class="layui-btn" lay-submit="" lay-filter="demo1" style="text-align: center; margin-top: 20px"
                        name="submit">确定修改
                </button>
            </div>
        </div>
    </form>
</div>
&lt;!&ndash;<table id="demo" lay-filter="test"></table>&ndash;&gt;
</body>
&lt;!&ndash;<script>
    layui.use('table', function(){
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#demo'
            ,height: 315
            ,url: "<?php echo url('Role/index_a'); ?>" //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'role', title: '角色', width:80}
                ,{field: 'descript', title: '描述', width:80,}
            ]]
        });

    });
</script>&ndash;&gt;
&lt;!&ndash;<script>
    $(function(){
        var checks = $("#iii input[type='checkbox']");
        $("#iii input[type='checkbox']").click(function(){
            var number = checks.filter(':checked').length;
            $('#number').html(number);
        });
        $("#qx").click(function(){
            if(this.checked){
                $("#one input[type='checkbox']").prop("checked",true);
                var number = checks.filter(':checked').length;
                $('#number').html(number);
            }else{
                $("#one input[type='checkbox']").prop("checked",false);
                $('#number').html(0);
            }
        })
    })
</script>&ndash;&gt;
<script>
    /*function cw() {
     var checklists = document.getElementsByName("selected");
     for (var m = 0; m < checklists.length; m++) {
     if (checklists[m].checked) {
     document.getElementById("controlAll1").checked = 1
     }
     }
     }
     function selectAll() {
     var checklist = document.getElementsByName("selected");
     if (document.getElementById("controlAll1").checked) {
     for (var i = 0; i < checklist.length; i++) {
     checklist[i].checked = 1;
     }
     } else {
     for (var j = 0; j < checklist.length; j++) {
     checklist[j].checked = 0;
     }
     }
     }*/
    layui.use(['layer', 'form'], function () {
        var form = layui.form
            , layer = layui.layer;
        //监听提交
        //监听提交
        form.on('submit(demo1)', function (data) {
            //console.log(data);
            /*layer.alert(JSON.stringify(data.field), {
             title: '最终的提交信息'
             });*/
            var datas = JSON.stringify(data.field);

            var submit = "submit";
            $.ajax({
                type: "post",
                url: "<?php echo url('Role/rolesave_sub'); ?>",
                data: {"data": datas, "submit": submit},
                dataType: "json",
                success: function (re) {
                    if (re == 1) {
                        window.location.href = "<?php echo url('Role/admin'); ?>"
                    } else {
                        if (re == 2) {
                            layer.msg('提示：角色名已被用');
                        } else {
                            window.location.reload()
                        }
                    }
                }
            });
            return false;
        });
    });
    function cws(id) {
        //自己选择父级默认被选
        var checklists = document.getElementsByClassName(id);
        for (var m = 0; m < checklists.length; m++) {
            if (checklists[m].checked) {
                document.getElementById(id).checked = 1
            }
        }
    }

    function selectAlls() {
        //选择父级自己全选
        alert(1111);
        var checklist = document.getElementsByClassName(ids);
        if (document.getElementById(ids).checked) {
            for (var i = 0; i < checklist.length; i++) {
                checklist[i].checked = 1;
            }
        } else {
            for (var j = 0; j < checklist.length; j++) {
                checklist[j].checked = 0;
            }
        }
    }

    function selecta() {
        var inp = $('#table').find('input');
        if (document.getElementById('qx').checked) {
            //全选
            for (var n = 0; n < inp.length; n++) {
                inp[n].checked = 1;
            }
        } else {
            //全不选
            for (var num = 0; num < inp.length; num++) {
                inp[num].checked = 0;
            }
        }
    }
</script>
</html>-->
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>网站信息</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<style>
    .bodys {
        color: #666;
    }

    .div {
        text-align: center;
        width: 1080px;
        margin: auto;
        padding-bottom: 30px;
    }

    table {
        border-collapse: collapse;
        width: 1080px
    }

    .spans {
        color: #000000;
        font-family: 黑体
    }

    .test_a {
        border: 1px solid black;
        width: 20%;
        vertical-align: middle;
        text-align: center;
        padding: 1px;
    }

    .test_b {
        border: 1px solid black;
        width: 70%;
        vertical-align: middle;
        text-align: left;
        padding: 20px
    }
</style>
<body class="bodys panel admin-panel">
<div class="panel-head"><strong><span class="icon-pencil-square-o"></span>角色信息</strong>&emsp;<a
        style="color: #3a4bfb;font-weight: bold " href="javascript:history.go(-1)">返回上一步</a></div>
<div class="div">
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">角色</label>
            <div style="margin-top: 10px" class="layui-input-block">
                <input name="role" id="role" type="text" class="layui-input" lay-verify="required" value="<?php echo $role['role']; ?>">
            </div>
        </div>
        <input type="hidden" name="id" value="<?php echo $role['id']; ?>">
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" name="descript"><?php echo $role['descript']; ?></textarea>
            </div>
        </div>

            <table style="color: darkgrey" id="table" lay-filter="table">

                <?php if(is_array($jurisdiction) || $jurisdiction instanceof \think\Collection || $jurisdiction instanceof \think\Paginator): $i = 0; $__LIST__ = $jurisdiction;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <tr>
                    <td class="test_a">
                        <?php if($vo['state'] == 1): ?>
                        <input onclick='selectAlls("<?php echo $vo['id']; ?>")' checked="checked" class="<?php echo $vo['id']; ?>"
                               name="like<?php echo $vo['id']; ?>" id="<?php echo $vo['id']; ?>"
                               type="checkbox" title="<?php echo $vo['jurisdiction']; ?>" value="<?php echo $vo['id']; ?>"/>
                        <?php else: ?>
                        <input onclick='selectAlls()' class="<?php echo $vo['id']; ?>" name="like<?php echo $vo['id']; ?>"
                               id="<?php echo $vo['id']; ?>" type="checkbox"
                               value="<?php echo $vo['id']; ?>" title="<?php echo $vo['jurisdiction']; ?>"/>
                        <?php endif; ?>
                    </td>
                    <td class="test_b">
                        <?php if(is_array($vo['child']) || $vo['child'] instanceof \think\Collection || $vo['child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vv): $mod = ($i % 2 );++$i;if($vv['state'] == 1): ?>
                        <input lay-skin="primary" onclick='cws("<?php echo $vo['id']; ?>")' checked="checked" value="<?php echo $vv['id']; ?>"
                               type="checkbox" name="like<?php echo $vv['id']; ?>" class="<?php echo $vo['id']; ?>"
                               title="<?php echo $vv['jurisdiction']; ?>"/>&nbsp;&emsp;
                        <?php else: ?>
                        <input lay-skin="primary" onclick='cws("<?php echo $vo['id']; ?>")' type="checkbox" value="<?php echo $vv['id']; ?>"
                               class="<?php echo $vo['id']; ?>" name="like<?php echo $vv['id']; ?>" title="<?php echo $vv['jurisdiction']; ?>"/>&nbsp;&emsp;
                        <?php endif; endforeach; endif; else: echo "" ;endif; ?>

                    </td>
                </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>

            </table>
        <div class="layui-form-item">
            <div style="margin: auto" class="layui-input-block">
                <!--<input type="checkbox" name="like[all]" title="全选" id="qx" value="全选"/>-->
                <!--<input style="text-align: center; margin-top: 20px"  type="submit" class="layui-btn" name="submit" value="确定修改"/>-->
                <button class="layui-btn" lay-submit="" lay-filter="demo1" style="text-align: center; margin-top: 20px"
                        name="submit">确定修改
                </button>
            </div>
        </div>
    </form>
</div>
<!--<table id="demo" lay-filter="test"></table>-->
</body>
<!--<script>
    layui.use('table', function(){
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#demo'
            ,height: 315
            ,url: "<?php echo url('Role/index_a'); ?>" //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'role', title: '角色', width:80}
                ,{field: 'descript', title: '描述', width:80,}
            ]]
        });

    });
</script>-->
<!--<script>
    $(function(){
        var checks = $("#iii input[type='checkbox']");
        $("#iii input[type='checkbox']").click(function(){
            var number = checks.filter(':checked').length;
            $('#number').html(number);
        });
        $("#qx").click(function(){
            if(this.checked){
                $("#one input[type='checkbox']").prop("checked",true);
                var number = checks.filter(':checked').length;
                $('#number').html(number);
            }else{
                $("#one input[type='checkbox']").prop("checked",false);
                $('#number').html(0);
            }
        })
    })
</script>-->
<script>
    /*function cw() {
     var checklists = document.getElementsByName("selected");
     for (var m = 0; m < checklists.length; m++) {
     if (checklists[m].checked) {
     document.getElementById("controlAll1").checked = 1
     }
     }
     }
     function selectAll() {
     var checklist = document.getElementsByName("selected");
     if (document.getElementById("controlAll1").checked) {
     for (var i = 0; i < checklist.length; i++) {
     checklist[i].checked = 1;
     }
     } else {
     for (var j = 0; j < checklist.length; j++) {
     checklist[j].checked = 0;
     }
     }
     }*/

    layui.use(['layer', 'form', 'table'], function () {
        var form = layui.form
            ,table =layui.table
            , layer = layui.layer;

        //实例化table

        //监听提交
        form.on('submit(demo1)', function (data) {
            //console.log(data);
            /*layer.alert(JSON.stringify(data.field), {
             title: '最终的提交信息'
             });*/
            var datas = JSON.stringify(data.field);

            var submit = "submit";
            $.ajax({
                type: "post",
                url: "<?php echo url('Role/rolesave_sub'); ?>",
                data: {"data": datas, "submit": submit},
                dataType: "json",
                success: function (re) {
                    if (re == 1) {
                        window.location.href = "<?php echo url('Role/admin'); ?>"
                    } else {
                        if (re == 2) {
                            layer.msg('提示：角色名已被用');
                        } else {
                            window.location.reload()
                        }
                    }
                }
            });
            return false;
        });
    });
    function cws(id) {
        //自己选择父级默认被选
        var checklists = document.getElementsByClassName(id);
        for (var m = 0; m < checklists.length; m++) {
            if (checklists[m].checked) {
                document.getElementById(id).checked = 1
            }
        }
    }

    function selectAlls() {
        //选择父级自己全选
        alert(1111);
        var checklist = document.getElementsByClassName(ids);
        if (document.getElementById(ids).checked) {
            for (var i = 0; i < checklist.length; i++) {
                checklist[i].checked = 1;
            }
        } else {
            for (var j = 0; j < checklist.length; j++) {
                checklist[j].checked = 0;
            }
        }
    }

    function selecta() {
        var inp = $('#table').find('input');
        if (document.getElementById('qx').checked) {
            //全选
            for (var n = 0; n < inp.length; n++) {
                inp[n].checked = 1;
            }
        } else {
            //全不选
            for (var num = 0; num < inp.length; num++) {
                inp[num].checked = 0;
            }
        }
    }
</script>
</html>

